<template>
  <div class="bg-[#232324] h-[100%]">
    <el-collapse v-loading="loading" v-model="activeNames">
      <el-form label-width="auto" :model="states" size="small">
        <el-collapse-item title="标题" name="1">
          <el-form-item label="主标题">
            <el-input v-model="states.title.text" />
          </el-form-item>
          <el-form-item label="主标题大小">
            <el-input v-model="states.title.textStyle.fontSize" />
          </el-form-item>
          <el-form-item label="主标题颜色">
            <el-color-picker v-model="states.title.textStyle.color" />
          </el-form-item>
          <el-form-item label="副标题">
            <el-input v-model="states.title.subtext" />
          </el-form-item>
          <el-form-item label="副标题大小">
            <el-input v-model="states.title.subtextStyle.fontSize" />
          </el-form-item>
          <el-form-item label="副标题颜色">
            <el-color-picker v-model="states.title.subtextStyle.color" />
          </el-form-item>
        </el-collapse-item>

        <el-collapse-item title="折线图-1" name="5">
          <el-form-item label="名称">
            <el-input v-model="states.series[0].name" />
          </el-form-item>
          <el-form-item label="区域颜色">
            <el-color-picker v-model="states.series[0].areaStyle.color" />
          </el-form-item>
          <el-form-item label="平滑">
            <el-switch v-model="states.series[0].smooth" />
          </el-form-item>
          <el-form-item label="标记类型">
            <el-select v-model="states.series[0].symbol" placeholder="Select">
              <el-option label="圆形" value="circle" />
              <el-option label="方形" value="rect" />
              <el-option label="圆角方形" value="roundRect" />
              <el-option label="三角形" value="triangle" />
              <el-option label="菱形" value="diamond" />
              <el-option label="倒三角形" value="pin" />
              <el-option label="箭头" value="arrow" />
              <el-option label="无" value="none" />
            </el-select>
          </el-form-item>
          <el-form-item label="线条宽度">
            <el-input-number v-model="states.series[0].lineStyle.width" />
          </el-form-item>
          <el-form-item label="线条颜色">
            <el-color-picker v-model="states.series[0].lineStyle.color" />
          </el-form-item>
          <el-form-item label="线条类型">
            <el-select
              v-model="states.series[0].lineStyle.type"
              placeholder="Select"
            >
              <el-option label="实线" value="solid" />
              <el-option label="虚线" value="dashed" />
              <el-option label="点线" value="dotted" />
            </el-select>
          </el-form-item>
        </el-collapse-item>
      </el-form>
    </el-collapse>
  </div>
</template>

<script setup>
import { computed, onMounted, ref } from "vue";
const loading = ref(true);
const activeNames = ref();
const props = defineProps({
  models: {
    type: Object,
    default: () => ({}),
  },
});
const emit = defineEmits(["update:models", "edit"]);

onMounted(() => {
  setTimeout(() => {
    loading.value = false;
  }, 200);
});

const states = computed({
  get: () => props.models,
  set: () => emit("update:models"),
});
const clicks = () => {
  emit("edit", "edit_");
};
</script>

<style scoped lang="scss">
:deep(.el-collapse-item__header) {
  padding-left: 10px !important;
}
</style>
